<?php
namespace app\admin\model;

class Wxmenu extends \think\Model{

    public static function allSubCat($id = 0){
        static $temp = [];
        $rs = self::where('parent_id', $id)->order('sort','desc')->select();
        foreach($rs as $val){
            $val = $val->getData();
            $val['depath'] = substr_count($val['cat_tree'], ",")-1;
            $temp[] = $val;
            self::allSubCat($val['id']);
        }
        return $temp;
    }
}